class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int ret = nums[0];
        int n = nums.size();
        for (int i = 1;i < n;i++)
        {
            ret = ret ^ nums[i];
        }
        for (int i = 0;i <= n;i++)
        {
            ret = ret ^ i;
        }
        return ret;
    }
};